
#ifndef __CFILE_H__
#define __CFILE_H__


#define MIN_BUFFER_SIZE 0x1000

typedef enum {
    LOADED_FILE_TYPE_NONE = 0,
    LOADED_FILE_TYPE_BMFS = 1,
    LOADED_FILE_TYPE_FILESYS = 2,
} LOADED_FILE_TYPE;

class CFile
{
public:
    CFile() : m_FileType(LOADED_FILE_TYPE_NONE),
        m_FileSize(0)
    {
        m_File.pBMFile = NULL;
    }

    ~CFile();

    ECode Init(const wchar_t *wszName);

    ECode Read(UInt32 offset, UInt32 size, Void *pBuf);

		ECode Write(UInt32 offset, UInt32 size, Void *pBuf);

    INLINE UInt32 GetSize() const { return m_FileSize;}


protected:
    LOADED_FILE_TYPE   m_FileType;
    union
    {
        Byte * pBMFile;
        IAbsoluteIO *pIAbsoluteIO;
    } m_File;
    UInt32   m_FileSize;
};






#endif//__CFILE_H__

